<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="com.lanou3g.bookstore.book.domain.Book" %>
<%@ page import="com.lanou3g.bookstore.category.domain.Category" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>My JSP 'bookdesc.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
        body {
            font-size: 10pt;
            background: rgb(254, 238, 189);
        }

        div {
            margin: 20px;
            border: solid 2px gray;
            width: 150px;
            height: 150px;
            text-align: center;
        }

        li {
            margin: 10px;
        }

        img {
            width: 110px;
            height: 150px;
        }
    </style>
    <script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
</head>

<body>
<%
    Book book = (Book) request.getAttribute("book");
    List<Category> bookClass = (List<Category>) request.getAttribute("bookClass");
%>
<div>
    <img src="<c:url value='<%=request.getContextPath() + "/" + book.getImage()%>'/>" border="0"/>
</div>
<form style="margin:20px;" id="form"
      action="<%=request.getContextPath()%>/adminjsps/admin/adminBook.do?bid=<%=book.getBid()%>" method="post">
    <input hidden name="image" value="<%=book.getImage()%>">
    图书名称：<input type="text" name="bname" value="<%=book.getBname()%>"/><br/>
    图书单价：<input id="price" type="text" name="price" value="<%=book.getPrice()%>"/><br/>
    图书作者：<input type="text" name="author" value="<%=book.getAuthor()%>"/><br/>
    图书分类：<select style="width: 150px; height: 20px;" name="cid">
    <%
        for (Category category : bookClass) {
    %>
    <option value="<%=category.getCid()%>"><%=category.getCname()%>
    </option>
    <%
        }
    %>
</select><br/>
    <input type="submit" name="method" value="del" onclick="return confirm('是否真要删除该图书？');"/>
    <input type="submit" name="method" value="mod"/>
</form>
<script type="text/javascript">
    $(function () {
        $("#price").keydown(function (event) {
            var keyCode = event.which;
            if (keyCode == 46 || keyCode == 190 || keyCode == 8 || (keyCode >= 48 && keyCode <= 57))
                return true;
            else
                return false;
        }).focus(function () {
            this.style.imeMode = 'disabled';
        });
    })
</script>
</body>
</html>
